home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / usr / sybase / doc / bcp_exec.man < prev    next >
Text File  |  1993-04-22  |  3KB  |  111 lines

  1.  
  2.   1                       Version 4.0 -- 5/1/89                 bcp_exec
  3.   ______________________________________________________________________
  4.  
  5.   NAME:  bcp_exec
  6.  
  7.   FUNCTION:
  8.        Execute a bulk copy of data between a database table and  a  host
  9.        file.
  10.  
  11.   SYNTAX:
  12.        RETCODE bcp_exec(dbproc, rows_copied)
  13.  
  14.        DBPROCESS *dbproc;
  15.        DBINT     *rows_copied;
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.   bcp_exec                Version 4.0 -- 5/1/89                        2
  25.   ______________________________________________________________________
  26.  
  27.   COMMENTS:
  28.  
  29.        o This routine copies data from a host file to a  database  table
  30.          or  vice-versa, depending on the value of the direction parame-
  31.          ter in bcp_init().
  32.        o Before calling this function you must call  bcp_init()  with  a
  33.          valid host filename. Failure to do so will result in an error.
  34.  
  35.        o The following program fragment illustrates bcp_exec():
  36.  
  37.          LOGINREC        *login;
  38.          DBPROCESS       *dbproc;
  39.          DBINT           rowsread;
  40.  
  41.          /* Initialize DB-Library. */
  42.          if (dbinit() == FAIL)
  43.              exit(ERREXIT);
  44.  
  45.  
  46.   3                       Version 4.0 -- 5/1/89                 bcp_exec
  47.   ______________________________________________________________________
  48.  
  49.          /* Install error-handler and message-handler. */
  50.          dberrhandle(err_handler);
  51.          dbmsghandle(msg_handler);
  52.  
  53.          /* Open a DBPROCESS. */
  54.          login = dblogin();
  55.          BCP_SETL(login, TRUE);
  56.          dbproc = dbopen(login, NULL);
  57.  
  58.          /* Initialize bcp. */
  59.          if (bcp_init(dbproc, "pubs..authors", "authors.save", (BYTE *)NULL, DB_OUT) == FAIL)
  60.              exit(ERREXIT);
  61.  
  62.          /* Now, execute the bulk copy. */
  63.          if (bcp_exec(dbproc, &rowsread) == FAIL)
  64.              printf("Incomplete bulk copy.  Only %ld row%c copied.\n",
  65.  
  66.  
  67.  
  68.   bcp_exec                Version 4.0 -- 5/1/89                        4
  69.   ______________________________________________________________________
  70.                      rowsread, (rowsread == 1) ? ' ': 's');
  71.  
  72.  
  73.        o For information on the bcp utility program, see its manual page
  74.          in the Commands Reference.
  75.  
  76.   PARAMETERS:
  77.        dbproc -  A pointer to the DBPROCESS structure that provides  the
  78.            connection for a particular front-end/SQL Server process.  It
  79.            contains all the information that DB-Library uses  to  manage
  80.            communications and data between the front end and SQL Server.
  81.        rows_copied -  A pointer to a DBINT. bcp_exec()  will  fill  this
  82.            DBINT  with the number of rows successfully copied. If set to
  83.            NULL, this parameter will not be filled in by bcp_exec().
  84.  
  85.   RETURNS:
  86.        SUCCEED or FAIL. bcp_exec()  returns  SUCCEED  if  all  rows  are
  87.        copied.  If  a  partial  or  complete  failure occurs, bcp_exec()
  88.  
  89.  
  90.   5                       Version 4.0 -- 5/1/89                 bcp_exec
  91.   ______________________________________________________________________
  92.        returns FAIL. Check the rows_copied parameter for the  number  of
  93.        rows successfully copied.
  94.  
  95.   SEE ALSO:
  96.        bcp_batch,   bcp_bind,   bcp_colfmt,   bcp_collen,    bcp_colptr,
  97.        bcp_columns, bcp_control, bcp_done, bcp_init, bcp_sendrow
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.